package com.atguigu.day22.exer.codetest;

import org.junit.Test;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/28 9:41
 * @注释
 */
public class CodeTest01 {
    @Test
    public void test01(){
        int sum = 0;
        String formula = "";
        for (int i = 1; i <= 100; i++) {
            if(i % 2 == 1){
                sum += i;
                if (i == 1){
                    formula += i;
                }else {
                    formula += "+" + i;
                }
            }
        }
        System.out.println(formula + "=" + sum);
    }
}
